package com.jiuli.liping.controller;


import com.jiuli.liping.service.ToOaService;
import com.jiuli.liping.service.WeiXinService;
import com.jiuli.liping.vo.Message;
import com.jiuli.liping.vo.OaMessage;
import com.jiuli.liping.vo.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping(value = "/tooa")
public class ToOaController {

    @Autowired
    private ToOaService toOaService;
    @Autowired
    private WeiXinService weiXinService;

    @RequestMapping(value = "/beginFlow", method = RequestMethod.POST)
    public Message insertBatch(@RequestBody List<OaMessage> oaMessages) {
        oaMessages.get(0).getUserName();

        Message message  =   toOaService.StartFlow(oaMessages);
        return message;
    }

    @RequestMapping(value = "/passFlow", method = RequestMethod.GET)
    public Message passFlow(@RequestParam String orderId,String userId) {
        Message message  =   weiXinService.PassFlow(orderId,userId);
        return message;
    }


    @RequestMapping(value = "/backFlow", method = RequestMethod.GET)
    public Message backFlow(@RequestParam String orderId,String userId) {
        Message message  =   weiXinService.BackFlow(orderId,userId);
        return message;
    }

    @RequestMapping(value = "/sendMsg", method = RequestMethod.GET)
    public Message sendMsg(@RequestParam String userCode,String message) {
        Message message1  =   weiXinService.sendMsg(userCode,message);
        return message1;
    }

}

